package com.xy.smartsms.data;

import android.app.Activity;

import org.json.JSONObject;

import java.util.List;
import java.util.Map;


public interface ISmsPlugin {
    /**
     * 卡片类型 - 丰富气泡
     */
    public static final int TYPE_RICH = 1 << 0;
    /**
     * 卡片类型 - 简单气泡
     */
    public static final int TYPE_SIMPLE = 1 << 1;
    /**
     * 卡片类型 - 特征值（一般是原文下加下划线）
     */
    public static final int TYPE_FEATURE = 1 << 2;
    /**
     * 卡片类型 - 敏感数据
     */
    public static final int TYPE_SENSITIVE = 1 << 3;

    /**
     * 成功
     */
    public static final int STATUS_SUCCESS = 0;
    /**
     * 失败
     */
    public static final int STATUS_FAIL = -1;

    void parseCard(int type, SmsItem item, ISmsPluginCallback callback);

    void parseCardSync(int type, SmsItem item);

    void parsePublicInfo(String phone, Map<String, String> extend, ISmsPluginCallback callback);

    void processAction(Activity activity, String action, Map<String, String> extend);

    void init(Object doAction, Map<String, String> extend);

    void backgroundParse(String phone, int limit);

    void loadCache(String phone);

    void clearCache(String phone);

    void setParam(Map<String, String> extend);

    String getParam(String key);

    interface ISmsPluginCallback {
        void onCard(int status, int type, JSONObject obj);

        void onPublicInfo(int status, PublicInfoData data);
    }

    interface ISmsPluginAction {
        List<SmsItem> getMessageList(String phone, long startTime, long endTime, int limit);
    }
}